<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport"
	content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<title>邮宝洗衣</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="css/type.css" rel="stylesheet" type="text/css">
<style type="text/css">
/*<![CDATA[*/
* html .decoration {
	position: absolute;
	right: 16px;
	top: 0;
} /*only for ie*/
/*]]>*/
</style>
<!-- Do not move the bellow script to custom.js! It must stay here to
    load properly! -->
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/jquerysession.js"></script>
<script type="text/javascript" src="scripts/custom.js" charset="utf-8"></script>
<script type="text/javascript" src="scripts/iscroll.js"></script>
<script type="text/javascript" src="scripts/layer/layer.m.js"></script>
<script type="text/javascript" src="scripts/laypage/laypage.js"></script>
<script type="text/javascript">
	var myScroll;
	var oldmenuId;
	function loaded() {
		myScroll = new iScroll('wrapper', {
			snap: true,
			momentum: false,
			hScrollbar: false,
			onBeforeScrollStart: function () {
				oldmenuId=myScroll.currPageX;
			},
			onScrollEnd: function () {
				if(oldmenuId!=myScroll.currPageX){
					$("body").animate({scrollTop: '0px'},500); 
					$("body").scrollTop(0);
					changMenu();
				}
			}
		 });
		//跳转第几页
		var toPage="${param.toPage}";//返回操作带上的值
		if(toPage!=""){
			myScroll.scrollToPage(toPage, 0);
		}
	}
	document.addEventListener('DOMContentLoaded', loaded, false);
</script>
</head>
<body onLoad="loadImages()">
	<p class="no-mobile">
		请使用手机访问本页面！ <br /> 这个页面是专门针对手机设计的！
	</p>
	<div class="site">
		<div id="hidepage">
			<p class="center-text">
				加载中，请耐心等待! <br /> <img src="images/background/130.gif"
					alt="load">
			</p>
		</div>
		<div class="navigation" id="navigation">
			<a id="home" class="selected" href="javascript:void(0)"> <img
				src="images/nav/item1ns_pre.png" alt="img"> <em
				class="under-icon-text"> 我要洗衣 </em>
			</a> <a id="about" href="javascript:void(0)"> <img src="images/nav/item2ns.png"
				alt="img"> <em class="under-icon-text"> 订单查询 </em>
			</a> <a id="portfolio" href="javascript:void(0)"> <img src="images/nav/item3ns.png"
				alt="img"> <em class="under-icon-text"> 个人中心 </em>
			</a> <a id="contact" href="javascript:void(0)"> <img src="images/nav/item4ns.png"
				alt="img"> <em class="under-icon-text"> 更多功能 </em>
			</a>
		</div>
		<div class="decoration">
			<p class="title">我要洗衣</p>
		</div>
		<div id="wrapper">
			<div id="scroller">
				<ul id="thelist">
					<!--home start  -->
					<li style="height: 100%">
						<div class="clothes" style="height: 100%;">
						</div>
					</li>
					<!--home end-->
					
					<!--order start-->
					<li id="order" style="display: none">
						<div class="order_btn" >
							<div class="btn_service">
								<a href="javascript:void(0)">
									<img src="images/order/service_1.png">
								</a>
							</div> 
							<div class="btn_completed">
								<a href="web/order/completed.jsp">
									<img src="images/order/completed_0.png">
								</a>
							</div> 
						</div>
						<div class='order_table' >
						</div>
						<div id="orderPage" ></div>
						<div id="pay" class="next_lag" >
							<a href="javascript:void(0)">
								<img src="images/order/payment.png">
							</a>
						</div> 
					</li>
					<!--order end-->
					
					<!--person start-->
					<li>
						<div class="person_bg" style="display: none">
							<!-- <img src="images/person/bg.png"> -->
							<div class="person_icon">
								<img src="images/person/icon.png" id="myIcon">
							</div>
							<div class="person_msg">
								<!-- <div><p><a>修改图像</a></p></div> -->
								<div><p>姓名:<font></font></p></div>
								<div><p>手机号码:<font></font></p></div>
								<div style="margin-left: 20%">
									<p style="float: left;">账户余额:￥<font></font></p>
									<div class="person_recharge">
										<a href="web/person/recharge.jsp" id="rechargeUrl">
											<img src="images/person/recharge.png">
										</a>
									</div> 
								</div>
							</div>
							<div class="person_btn">
								<div class="btn_addrmanage">
									<a href="web/person/addrmanage.jsp">
										<img src="images/person/addr_manage.png">
									</a>
								</div> 
								<div class="btn_paydetails">
									<a href="transactionRouter?funcID=0021" id="payAndIncome">
										<img src="images/person/pay_details.png">
									</a>
								</div> 
							</div>
						</div>
					</li>
					<!--person end-->
					
					<li>
						<div class="mores">
							<div id="moreBtns">
								<div class="more_btns">
									<img  src="images/more/more_11.png" onclick="choiceMoreImage('1')">
									<img  src="images/more/more_02.png" onclick="choiceMoreImage('2')">
								</div>
								<div class="more_btns">
									<img  src="images/more/more_03.png" onclick="choiceMoreImage('3')">
									<img  src="images/more/more_04.png" onclick="choiceMoreImage('4')">
								</div>
							</div>
							<hr style="height:1px;border:none;border-top:1px solid #a0a0a0;" />
							<div class="more_content">
								<div id="more1" class="morePI">
									<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮宝洗衣是高品质的O2O洗衣服务。您可以足不出户，轻松完成洗衣的繁琐工作。
	目前可通过我们电话、微信等渠道进行下单、预约好时间地点，就会有邮宝服务人员按时上门收取衣服。经过10多道专业清洗工序后，将熨烫平整的衣服送回。
	</p>
									<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;专业洗衣、免费收派、价格实惠是我们的追求。因为专注，所以卓越。</p>
									<br>
									<div class="more_image">
										<img  src="images/more/more_image1.png">
									</div>
								</div>
								<div id="more2" class="morePI hide">
									<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;所在区目前只支持选择 鲤城区、丰泽区、洛江区、晋江桥南片区(新加坡城一、二期，中骏蓝湾半岛，中央领地，中央墅府，中央公园，蓝天裕景，左岸英郡，映辉江山，江夏丽景，锦州瑞苑，海丝景城)</p>
									<br>
									<div class="more_image">
										<img  src="images/more/more_image2.png">
									</div>
								</div>
								<div id="more3" class="morePI hide">
									<div class="more_image">
										<img  src="images/more/more_image3.png">
									</div>
								</div>
								<div id="more4" class="morePI hide">
									<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;福州友宝电子科技有限公司成立于2012年9月，主营业务：智能快递终端系统研发、销售及社区综合O2O服务运营。公司拥有员工40人以上，其中技术开发人员占50%以上。2014年公司在杭州成立新的研发中心。 公司产品智能快件箱解决了快递最后100米的时空差和效率问题。此外，基于遍布社区、高校、写字楼的终端网点，公司将拓展菜篮子、社区金融等O2O便民服务。 公司项目是《福布斯》中文杂志2013中国30个30岁以下创业者项目之一，参加IBM Smart Camp 获得多项国家专利和软件著作权</p>
									<br>
									<div class="more_image">
										<img  src="images/more/more_image4.png">
									</div>
								</div>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	 $(document).ready(function () {
		 	//$.session.clear();
		 	$.session.set('totalNum',0);
		 	$.session.set('receiveAddr','null');
		 	$.session.set('name','null');
		 	$.session.set('mobileNum','null');
		 	//$.session.set('platformId','oNtWKjr4azG8R5A7J2gRI4OawFyQ');
		 	var toPage="${param.toPage}";
		 	if(toPage=="0"){
		 		loadHome();
		 		loadOrder();
		 		loadPerson();
		 		loadMore();
		 	}else if(toPage=="1"){
		 		loadOrder();
		 		loadHome();
		 		loadPerson();
		 		loadMore();
		 	}else if(toPage=="2"){
		 		loadPerson();
		 		loadHome();
		 		loadOrder();
		 		loadMore();
		 	}else if(toPage=="3"){
		 		loadMore();
		 		loadPerson();
		 		loadHome();
		 		loadOrder();
		 	}else{
		 		loadHome();
		 		loadOrder();
		 		loadPerson();
		 		loadMore();
		 	}
		 	
		});
	 
	 $("#skipGetCloth").live("mousedown",function(){
		 var number = $("#cnumber").html();
		 var price = $("#cprice").html();
		 if(number=='0'){
			 layer.open({content: '请选择待洗衣物！',time: 2});
		 }else{
			 var commodityIds = "";
			 var goodsNums = "";
			 var cloth = $(".clothe");
			 for(var i=0;i<cloth.length;i++){
				 var num = $(cloth[i]).find(".numberdiv p").html();
				 if(num!=0){
					 commodityIds+=($(cloth[i]).attr("commodityID")+",");
					 goodsNums+=(num+",");
				 }
			 }
			 $.session.set('commodityIds', commodityIds);
			 $.session.set('goodsNums', goodsNums);
			 $.session.set('totalNum', number);
			 $.session.set('totalPrice', price);
			 location.href = "web/home/getcloth.jsp";
		 }
	 });
	 $("#ydetail").live("click",function(){
		location.href = "web/order/detail.jsp?orderNum="+$(".order_td_content").first().html()+"&curPage="+$("#curPage").val();
	 });
	 $("#track").live("click",function(){
		location.href = "web/order/track.jsp?orderNum="+$(".order_td_content").first().html()+"&curPage="+$("#curPage").val();
	 });
	 $("#pay").live("click",function(){
		location.href = "web/person/payOrder.jsp?price="+$(".order_td_content:eq(5)").find("font").html()+"&orderNum="+$(".order_td_content").first().html()+"&balance="+$(".person_msg").find("font:eq(2)").html()+"&curPage="+$("#curPage").val();
	 });
	 
	 //加载我要洗衣首页
	 function loadHome(){
		 var url="transactionRouter?funcID=0001";
		 $.ajax({  
	         type : "get",  
	         url : url,  
	         async: false,  
	         success : function(v){  
	        	 $(".clothes").html(v);
	         }
		 });
		/*  $.post(url, function(v) {
				$(".clothes").html(v);
		 }); */
	 }
	 //加载订单查询
	 function loadOrder(){
		 var url="transactionRouter?funcID=0004&platformId="+$.session.get("platformId");
		 $.ajax({  
	         type : "get",  
	         url : url,  
	         async: false,  
	         success : function(v){  
	        	 if(v.transactionList.length!=0){
	     			var curPage="${param.curPage}";
	     			if(curPage=="")curPage=1;
	     			if(curPage=="last")curPage=v.transactionList.length;
	     				laypage({
	     				    cont: 'orderPage',
	     					pages: v.transactionList.length,
	     				    curr: curPage,
	     				    first: false,
	     				    last: false,
	     				    //prev: false,
	     				    //next: false,
	     				    groups: 1,
	     				    skin: '#ff6c0d',
	     				    jump: function(e){
	     				    	var url = "<%=path%>/web/index/orderAjax.jsp?";
	     				        var i = e.curr-1;
	     				        var transaction = v.transactionList[i];
	     						var startTime = new Date(transaction.startTime);
	     						url += "orderNum="+transaction.orderNum+"&startTime="+startTime.Format("yyyy-MM-dd hh:mm:ss")
	     							+"&status="+transaction.status+"&sendAndReceiveType="+transaction.sendAndReceiveType
	     							+"&totalNum="+transaction.totalNum+"&check="+transaction.check+"&paymentPrice="+transaction.paymentPrice
	     							+"&payment="+transaction.payment+"&comment="+encodeURIComponent(transaction.comment)+"&curPage="+e.curr;
	     						$.post(url, function(data) {
	     							$("#order").show();
	     							$(".order_table").html(data);
	     						});
	     						if(transaction.payment==1){
	     							$("#pay").addClass("hide");
	     						}else{
	     							if(transaction.check==0)$("#pay").addClass("hide");
	     							if(transaction.check==1)$("#pay").removeClass("hide");
	     						}
	     				     }
	     				});
	     			}else{
	     				$("#order").show();
	     				$("#order").load("<%=path%>/web/index/noOrderAjax.jsp");
	     			}
	         }
		 });
		
	 }
	 //加载个人中心
	 function loadPerson(){
		 var url="transactionRouter?funcID=0007&platformId="+$.session.get("platformId");
		 $.ajax({  
	         type : "get",  
	         url : url,  
	         async: false,  
	         success : function(v){  
	        	$(".person_bg").show();
				$(".person_msg").find("font:eq(0)").html(v.lastName+v.firstName);
				$(".person_msg").find("font:eq(1)").html(v.mobileNum);
				$(".person_msg").find("font:eq(2)").html(v.balance);
				if(v.icon==""){
					$("#myIcon").attr("src","images/person/icon.png");
				}else{
					$("#myIcon").attr("src",v.icon);
				}
				$("#rechargeUrl").attr("href","web/person/recharge.jsp?balance="+v.balance);
				$("#payAndIncome").attr("href","transactionRouter?funcID=0021&userId="+v.userId);
	         }
		 });
	 }
	//加载更多功能
	 function loadMore(){
		 $(".mores").show();
	 }
	 function loadImages() {
        if (document.getElementById) { // DOM3 = IE5, NS6
            document.getElementById('hidepage').style.visibility = 'hidden';
        } else {
            if (document.layers) { // Netscape 4
                document.hidepage.visibility = 'hidden';
            } else { // IE 4
                document.all.hidepage.style.visibility = 'hidden';
            }
        }
        var openid=$.session.get("platformId");
        if(typeof openid == "undefined"||openid==""){
			layer.open({content: '请先注册！',time: 2,end: function(){location.href = "http://serviceapi.24box.cn/register.jsp?platformId="+openid;}});
		}
    }
</script>
</body>
</html>